import { ref } from 'vue';
import { getPurchaseDetailsApi } from '@/api/sj/purchaseManagement/toBeStored/index'

const usePurchase = () => {

    const purchaseCollectVisible = ref(false);
    const purchaseCollectDetails = ref();
    const purchaseCollectRow = ref();

    /**
     * @description: 打开采购验收
     */ 
    const handleOpenPurchaseCollect = async (row: any) => {
        console.log(row);
        purchaseCollectRow.value = row;

        try {
            const {data} = await getPurchaseDetailsApi(row.id);
            purchaseCollectDetails.value = data;
        } catch (error) {
            
        }

        purchaseCollectVisible.value = true;
    };

    return {
        purchaseCollectVisible,
        purchaseCollectRow,
        purchaseCollectDetails,
        handleOpenPurchaseCollect
    }
};

export default usePurchase;